//
//  KLSGRecomendCell.m
//  KaoLaShiGuangFM
//
//  Created by lanou3g on 15/10/28.
//  Copyright © 2015年 com.lanou3g. All rights reserved.
//

#import "KLSGRecomendCell.h"

@implementation KLSGRecomendCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubView];
    }
    
    return self;
}

- (void)addSubView
{
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame) - 40)];
    [self addSubview:_imageView];
    
    NSArray *views = self.imageView.subviews;
    for (UIView *subView in views) {
        [subView removeFromSuperview];
    }
    
    for (int i = 0; i < 20; i++) {
        CGFloat num = 1.0 / 20 * (20 - i);
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, _imageView.frame.size.height - i, _imageView.frame.size.width, 1)];
        view.backgroundColor = [UIColor colorWithRed:0 / 255.0 green:0 / 255.0 blue:0 / 255.0 alpha:num];
        [_imageView addSubview:view];
    }
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(self.imageView.frame) - 20, CGRectGetWidth(self.imageView.frame), 20)];
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = [UIFont systemFontOfSize:10];
    self.titleLabel.textColor = [UIColor whiteColor];
    [self addSubview:_titleLabel];
    
    self.trackTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(self.imageView.frame), self.frame.size.width, 40)];
    self.trackTitleLabel.font = [UIFont systemFontOfSize:13];
    self.trackTitleLabel.numberOfLines = 0;
    [self addSubview:_trackTitleLabel];
}

@end
